interface LabelledValue {
    label: string;
}
function printLabel(labelledValue: LabelledValue) {
    console.log(labelledValue.label);
}
let myObj = { size: 10, label: "Size" };
printLabel(myObj); // Output: Size

interface Person {
    b?: string | undefined
    a: string
}

const person: Person = {
    a: 'hello',
    b: undefined
}

console.log(person.a);
console.log(person.b);


interface Point {
    readonly x: number;
    readonly y: number;
}
let p1: Point = { x: 10, y: 20 };

interface SearchFunc {
    (source: string, subString: string): boolean;
}

let mySearch: SearchFunc;
mySearch = function (source: string, subString: string) {
    let result = source.search(subString);
    return result > -1;
}


mySearch = function (src: string, sub: string): boolean {
    let result = src.search(sub)
    return result > -1
}

// function fun22(): void {
//     return 2222
// }
// class Fun22 implements Person {
//     a: string
//     b?: string | undefined
//     fun22() {
//         return 2222
//     }
// }

// interface IFun1 extends Fun22 {
//     (): void;
// }

// let fun111: IFun1 = function (this: any) {
//     Fun22.prototype.fun22.call(this)
//     return 22
// }

interface StringArray {
    [index: number]: string;
}

let myArray: StringArray = ["hello", "world"];
console.log(myArray[0]); // Output: hello
